/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

/*
* Thickbox 3.1 - One Box To Rule Them All.
* By Cody Lindley (http://www.codylindley.com)
* Copyright (c) 2007 cody lindley
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

var tb_pathToImage = "/img/pubimg/loading.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
$(document).ready(function () {
    tb_init('a.thickbox, area.thickbox, input.thickbox, span.thickbox'); //pass where to apply thickbox
    imgLoader = new Image(); // preload image
    imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk) {
    $(domChunk).click(function () {
        var t = this.title || this.name || null;
        var a = this.href || this.alt;
        var g = this.rel || false;
        tb_show(t, a, g);
        this.blur();
        return false;
    });
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

    try {
        if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
            $("body", "html").css({ height: "100%", width: "100%" });
            $("html").css("overflow", "hidden");
            if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
                $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
                //$("#TB_overlay").click(tb_remove);
            }
        } else {//all others
            if (document.getElementById("TB_overlay") === null) {
                $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
                //$("#TB_overlay").click(tb_remove);
            }
        }

        if (tb_detectMacXFF()) {
            $("#TB_overlay").addClass("TB_overlayMacFFBGHack"); //use png overlay so hide flash
        } else {
            $("#TB_overlay").addClass("TB_overlayBG"); //use background and opacity
        }

        if (caption === null) { caption = ""; }
        $("body").append("<div id='TB_load'><img src='" + imgLoader.src + "' /></div>"); //add loader to the page
        $('#TB_load').show(); //show loader

        var baseURL;
        if (url.indexOf("?") !== -1) { //ff there is a query string involved
            baseURL = url.substr(0, url.indexOf("?"));
        } else {
            baseURL = url;
        }

        var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
        var urlType = baseURL.toLowerCase().match(urlString);

        if (urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp') {//code to show images

            TB_PrevCaption = "";
            TB_PrevURL = "";
            TB_PrevHTML = "";
            TB_NextCaption = "";
            TB_NextURL = "";
            TB_NextHTML = "";
            TB_imageCount = "";
            TB_FoundURL = false;
            if (imageGroup) {
                TB_TempArray = $("a[@rel=" + imageGroup + "]").get();
                for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
                    var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
                    if (!(TB_TempArray[TB_Counter].href == url)) {
                        if (TB_FoundURL) {
                            TB_NextCaption = TB_TempArray[TB_Counter].title;
                            TB_NextURL = TB_TempArray[TB_Counter].href;
                            TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
                        } else {
                            TB_PrevCaption = TB_TempArray[TB_Counter].title;
                            TB_PrevURL = TB_TempArray[TB_Counter].href;
                            TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
                        }
                    } else {
                        TB_FoundURL = true;
                        TB_imageCount = "Image " + (TB_Counter + 1) + " of " + (TB_TempArray.length);
                    }
                }
            }

            imgPreloader = new Image();
            imgPreloader.onload = function () {
                imgPreloader.onload = null;

                // Resizing large images - orginal by Christian Montoya edited by me.
                var pagesize = tb_getPageSize();
                var x = pagesize[0] - 150;
                var y = pagesize[1] - 150;
                var imageWidth = imgPreloader.width;
                var imageHeight = imgPreloader.height;
                if (imageWidth > x) {
                    imageHeight = imageHeight * (x / imageWidth);
                    imageWidth = x;
                    if (imageHeight > y) {
                        imageWidth = imageWidth * (y / imageHeight);
                        imageHeight = y;
                    }
                } else if (imageHeight > y) {
                    imageWidth = imageWidth * (y / imageHeight);
                    imageHeight = y;
                    if (imageWidth > x) {
                        imageHeight = imageHeight * (x / imageWidth);
                        imageWidth = x;
                    }
                }
                // End Resizing

                TB_WIDTH = imageWidth + 30;
                TB_HEIGHT = imageHeight + 60;
                $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='" + url + "' width='" + imageWidth + "' height='" + imageHeight + "' alt='" + caption + "'/></a>" + "<div id='TB_caption'>" + caption + "<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='关闭' class='closeGray'></a></div>");

                $("#TB_closeWindowButton").click(tb_remove);

                if (!(TB_PrevHTML === "")) {
                    function goPrev() {
                        if ($(document).unbind("click", goPrev)) { $(document).unbind("click", goPrev); }
                        $("#TB_window").remove();
                        $("body").append("<div id='TB_window'></div>");
                        tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
                        return false;
                    }
                    $("#TB_prev").click(goPrev);
                }

                if (!(TB_NextHTML === "")) {
                    function goNext() {
                        $("#TB_window").remove();
                        $("body").append("<div id='TB_window'></div>");
                        tb_show(TB_NextCaption, TB_NextURL, imageGroup);
                        return false;
                    }
                    $("#TB_next").click(goNext);

                }

                document.onkeydown = function (e) {
                    if (e == null) { // ie
                        keycode = event.keyCode;
                    } else { // mozilla
                        keycode = e.which;
                    }
                    if (keycode == 27) { // close
                        tb_remove();
                    } else if (keycode == 190) { // display previous image
                        if (!(TB_NextHTML == "")) {
                            document.onkeydown = "";
                            goNext();
                        }
                    } else if (keycode == 188) { // display next image
                        if (!(TB_PrevHTML == "")) {
                            document.onkeydown = "";
                            goPrev();
                        }
                    }
                };

                tb_position();
                $("#TB_load").remove();
                $("#TB_ImageOff").click(tb_remove);
                $("#TB_window").css({ display: "block" }); //for safari using css instead of show
            };

            imgPreloader.src = url;
        } else {//code to show html

            var queryString = url.replace(/^[^\?]+\??/, '');
            var params = tb_parseQuery(queryString);

            TB_WIDTH = (params['width'] * 1) + 0 || 630; //defaults to 630 if no paramaters were added to URL
            TB_HEIGHT = (params['height'] * 1) + 0 || 440; //defaults to 440 if no paramaters were added to URL
            ajaxContentW = TB_WIDTH - 0;
            ajaxContentH = TB_HEIGHT - 0;

            if (url.indexOf('TB_iframe') != -1) {// either iframe or ajax window		
                urlNoQuery = url.split('TB_');
                $("#TB_iframeContent").remove();
                if (params['modal'] != "true") {//iframe no modal
                    $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + caption + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='关闭' class='closeGray'></a></div></div><iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 0) + "px;height:" + (ajaxContentH + 0) + "px;' > </iframe>");
                } else {//iframe modal
                    $("#TB_overlay").unbind();
                    $("#TB_window").append("<iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 0) + "px;height:" + (ajaxContentH + 0) + "px;'> </iframe>");
                }
            } else {// not an iframe, ajax
                if ($("#TB_window").css("display") != "block") {
                    if (params['modal'] != "true") {//ajax no modal
                        $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + caption + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='关闭' class='closeGray'></a></div></div><div id='TB_ajaxContent' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px'></div>");
                    } else {//ajax modal
                        $("#TB_overlay").unbind();
                        $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px;'></div>");
                    }
                } else {//this means the window is already up, we are just loading new content via ajax
                    $("#TB_ajaxContent")[0].style.width = ajaxContentW + "px";
                    $("#TB_ajaxContent")[0].style.height = ajaxContentH + "px";
                    $("#TB_ajaxContent")[0].scrollTop = 0;
                    $("#TB_ajaxWindowTitle").html(caption);
                }
            }

            $("#TB_closeWindowButton").click(tb_remove);

            if (url.indexOf('TB_inline') != -1) {
                $("#TB_ajaxContent").append($('#' + params['inlineId']).children());
                $("#TB_window").unload(function () {
                    $('#' + params['inlineId']).append($("#TB_ajaxContent").children()); // move elements back when you're finished
                });
                tb_position();
                $("#TB_load").remove();
                $("#TB_window").css({ display: "block" });
            } else if (url.indexOf('TB_iframe') != -1) {
                tb_position();
                if ($.browser.safari) {//safari needs help because it will not fire iframe onload
                    $("#TB_load").remove();
                    $("#TB_window").css({ display: "block" });
                }
            } else {
                $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()), function () {//to do a post change this load method
                    tb_position();
                    $("#TB_load").remove();
                    tb_init("#TB_ajaxContent a.thickbox");
                    $("#TB_window").css({ display: "block" });
                });
            }

        }

        if (!params['modal']) {
            document.onkeyup = function (e) {
                if (e == null) { // ie
                    keycode = event.keyCode;
                } else { // mozilla
                    keycode = e.which;
                }
                if (keycode == 27) { // close
                    tb_remove();
                }
            };
        }

    } catch (e) {
        //nothing here
    }
}

//helper functions below
function tb_showIframe() {
    $("#TB_load").remove();
    $("#TB_window").css({ display: "block" });
}

function tb_remove() {
    $("#TB_imageOff").unbind("click");
    $("#TB_closeWindowButton").unbind("click");
    $("#TB_window").fadeOut("fast", function () { $('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove(); });
    $("#TB_load").remove();
    if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
        $("body", "html").css({ height: "auto", width: "auto" });
        $("html").css("overflow", "");
    }
    document.onkeydown = "";
    document.onkeyup = "";
	if(typeof tb_remove_after =="function"){
		tb_remove_after();tb_remove_after=null;
	}
    return false;
}

function tb_position() {
    $("#TB_window").css({ marginLeft: '-' + parseInt((TB_WIDTH / 2), 10) + 'px', width: TB_WIDTH + 'px' });
    //$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px'});
    if (!(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
        $("#TB_window").css({ marginTop: '-' + parseInt((TB_HEIGHT / 2), 10) + 'px' });
    }
}

function tb_parseQuery(query) {
    var Params = {};
    if (!query) { return Params; } // return empty object
    var Pairs = query.split(/[;&]/);
    for (var i = 0; i < Pairs.length; i++) {
        var KeyVal = Pairs[i].split('=');
        if (!KeyVal || KeyVal.length != 2) { continue; }
        var key = unescape(KeyVal[0]);
        var val = unescape(KeyVal[1]);
        val = val.replace(/\+/g, ' ');
        Params[key] = val;
    }
    return Params;
}

function tb_getPageSize() {
    var de = document.documentElement;
    var w = window.innerWidth || self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
    var h = window.innerHeight || self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
    arrayPageSize = [w, h];
    return arrayPageSize;
}
/*公用的提示信息*/
function successMessage(msgTitle, msgCon, redirectUrl) {
    tb_remove();
    if (!redirectUrl) {
        redirectUrl = 'javascript:void(0)';
    }
    setTimeout(function () {
        var divid = "show_successMessage";
        if (!document.getElementById(divid)) {
            var createDiv = document.createElement("div");
            createDiv.style.display = "none";
            createDiv.id = divid;
            document.body.appendChild(createDiv);
        }
        var box = document.getElementById(divid);
        var h = '';
        h += '<div class="zhul_success_msg">';
        h += ' 	<p class="zhul_tj_gzicon"></p><span class="zhul_tj_cg">' + msgCon + '</span>';
        h += '</div>';
        h += '<div id="show" style="clear:both; color:#666; padding:20px 0 0 20px;">3秒后自动关闭</div>';
        box.innerHTML = h;
        tb_show('提示信息', '#TB_inline?height=110&width=300&inlineId=' + divid, "thickbox");
    }, 300);
    window.setTimeout("autoCloseWindow('"+redirectUrl+"')",3000); 
}
function errorMessage(msgTitle,msgCon,redirectUrl,boxWidth,boxHeight) {
    tb_remove();
    if (!redirectUrl) {
        redirectUrl = 'javascript:void(0)';
    }
	if(!boxWidth){
		boxWidth=300;
	}
	if(!boxHeight){
		boxHeight=120;
	}
    setTimeout(function () {
        var divid = "show_errorMessage";
        if (!document.getElementById(divid)) {
            var createDiv = document.createElement("div");
            createDiv.style.display = "none";
            createDiv.id = divid;
            document.body.appendChild(createDiv);
        }
        var box = document.getElementById(divid);
        var h = '';
        h += '<div class="zhul_success_mskg">';
        h += ' 	<p class="zhul_tj_error"></p><span class="zhul_tj_cg">' + msgCon + '</span>';
        h += '</div>';
        h += '<div class="zhul_tj_submit" style="clear:both"><a class="zhul_tj_sure" href="' + redirectUrl + '" onclick="tb_remove();"></a></div>';
        box.innerHTML = h;
		tb_show('提示信息', "#TB_inline?height="+boxHeight+"&width="+boxWidth+"&inlineId=" + divid, "thickbox");
    }, 300);
}
function tb_detectMacXFF() {
    var userAgent = navigator.userAgent.toLowerCase();
    if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox') != -1) {
        return true;
    }
}

/**
*   公用弹框 可传参，其中
*	msgTitle	弹框的title
*	msgWidth	弹框的宽
*	msgHeight	弹框的高
*	divId		弹框内容id
*/
function pubMsgbox(msgTitle,msgWidth,msgHeight,divId){
    if(document.getElementById(divId)){
	   tb_show(msgTitle,"#TB_inline?height="+msgHeight+"&width="+msgWidth+"&inlineId="+divId);
    }
}
function autoCloseWindow(redirectUrl){
	tb_remove();
	window.location.href=redirectUrl;
}
/**
*  删除提醒
*	functionName 用户点击确定后执行的函数
*	title		 提示框title
*	param		 传递给函数的参数，多个参数可以组装成一个对象
*   content		 提醒的内容
*/
function delMessage(functionName,msgTitle,param,content) {
    tb_remove();
    if (!content) {
        content = '';
    }
    setTimeout(function () {
        var divid = "show_delMessage";
        if (!document.getElementById(divid)) {
            var createDiv = document.createElement("div");
            createDiv.style.display = "none";
            createDiv.id = divid;
            document.body.appendChild(createDiv);
        }
        var box = document.getElementById(divid);
        var h = '';
        h += '		<div class="zhul_delMessage">';
		if(content!='') {
			h+='<p class="zhul_delmsg">' + content + '</p>'; 
		}else{
			h += '		<p class="zhul_delmsg">确定要删除吗？</p>';
			}
        h+='</div>';
        h += ' 		<div class="zhul_ly_fbbot">';
        h += '			<div class="zhul_ly_tjright">';
        h += '				<input type="submit" value="" class="zhul_glbz_qxbtn" onclick="tb_remove()">';
        h += '				<input type="submit" value="" class="zhul_delbtn" onclick="' + functionName + '(' + param + ')">';
        h += '			</div>';
        h += '		</div>';
        box.innerHTML = h;
        if (content != '') {tb_show(msgTitle, '#TB_inline?height=150&width=360&inlineId=' + divid, "thickbox");}
        else {tb_show(msgTitle, '#TB_inline?height=150&width=360&inlineId=' + divid, "thickbox");}
    }, 300);
}
/**
*  其它提醒
*	functionName 用户点击确定后执行的函数
*	title		 提示框title
*	param		 传递给函数的参数，多个参数可以组装成一个对象
*   content		 提醒的内容
*/
function infoMessage(functionName,msgTitle,param,content,btnClass) {
    tb_remove();
    if (!content) {
        content = '';
    }
    setTimeout(function () {
        var divid = "show_delMessage";
        if (!document.getElementById(divid)) {
            var createDiv = document.createElement("div");
            createDiv.style.display = "none";
            createDiv.id = divid;
            document.body.appendChild(createDiv);
        }
        var box = document.getElementById(divid);
        var h = '';
        h += '		<div class="zhul_delMessage">';
		if(content!='') {
			h+='<p class="zhul_delmsg">' + content + '</p>'; 
		}else{
			h += '		<p class="zhul_delmsg">确定要删除吗？</p>';
			}
        h+='</div>';
        h += ' 		<div class="zhul_ly_fbbot">';
        h += '			<div class="zhul_ly_tjright">';
        h += '				<input type="submit" value="" class="zhul_glbz_qxbtn" onclick="tb_remove()">';
        h += '				<input type="submit" value="" class="'+btnClass+'" style="float:right" onclick="' + functionName + '(' + param + ')">';
        h += '			</div>';
        h += '		</div>';
        box.innerHTML = h;
        if (content != '') {tb_show(msgTitle, '#TB_inline?height=150&width=360&inlineId=' + divid, "thickbox");}
        else {tb_show(msgTitle, '#TB_inline?height=150&width=360&inlineId=' + divid, "thickbox");}
    }, 300);
}
/**
*   评论成功
*	content 弹框内容
*/
function reviewSuccess(content,t){
	if(!document.getElementById("show_box")){
		var createDiv=document.createElement("div");
		createDiv.id="show_box";
		document.body.appendChild(createDiv);
	}
	var box=document.getElementById("show_box");
	var h = '';
    h+='<div class="zhul_success">';
	h+='	<span class="zhul_successIcon"></span>';
	h+='	<span class="zhul_successtitle">'+content+'</span>';
	h+='</div>';
	box.innerHTML = h;
    var t_time = 3000;
    if(typeof t != 'undefined'){
        t_time = parseInt(t);
    } 
	setTimeout(function(){
			if(document.getElementById("show_box")){
				document.getElementById("show_box").parentNode.removeChild(document.getElementById("show_box"));
			}
		}
	,t_time);
}

function reviewSuccess_height(content){
	var createDiv=document.createElement("div");
	createDiv.id="show_box";
	document.body.appendChild(createDiv);
	var box=document.getElementById("show_box");
	var h = '';
    h+='<div class="zhul_success" style="padding:50px 40px 50px 30px;">';
	h+='	<span class="zhul_successIcon"></span>';
	h+='	<span class="zhul_successtitle">'+content+'</span>';
	h+='</div>';
	box.innerHTML = h; 
	var t_time = 3000;
	setTimeout(function(){
			if(document.getElementById("show_box")){
				document.getElementById("show_box").parentNode.removeChild(document.getElementById("show_box"));
			}
		}
	,t_time);
}

/**
*   错误提示
*   content 弹框内容
*/
function reviewError(content,t){
    var createDiv=document.createElement("div");
    createDiv.id="show_box";
    document.body.appendChild(createDiv);
    var box=document.getElementById("show_box");
    var h = '';
    h+='<div class="zhul_success">';
    h+='    <span class="zhul_errorIcon"></span>';
    h+='    <span class="zhul_successtitle">'+content+'</span>';
    h+='</div>';
    box.innerHTML = h; 
    var t_time = 3000;
    if(typeof t != 'undefined'){
        t_time = parseInt(t);
    } 
    setTimeout('document.getElementById("show_box").style.display="none";$("#show_box").remove();',t_time);
}

/*截取字符长度*/
function substr(val, num) {
            val = $.trim(val);
            if (this.getStrlen(val) <= num) {
                return val;
            } else {
                var len = 0;
                for (var i = 0; i < val.length; i++) {
                    if (val.substr(i,  1).match(/[^\x00-\xff]/ig) != null) //全角
                        len += 2;
                    else
                        len += 1;
                    if (len == num * 2) {
                        return val.substr(0, i + 1);
                    }
                    if (len > num * 2) {
                        return val.substr(0, i);
                    }
                }
            }
        }
/*判断字符长度*/
 function getStrlen(val) {
            val = $.trim(val);
            if (val == "") {
                return 0;
            }
            var len = 0;
            for (var i = 0; i < val.length; i++) {
                if (val.substr(i,1).match(/[^\x00-\xff]/ig) != null) //全角
                    len += 2;
                else
                    len += 1;
            }
            return Math.ceil(len / 2);
        }
/**
*   转播弹框
*	content		转播内容
*	imgArray	图片url，数组
*/
function turnFrame(contentId,img){
	if(uid<=0){
		widow_Loading();
		return;
	}
	tb_remove();
	var content = substr($('#'+contentId).text(),97);         
	var contentHmtl= $("#"+contentId).html(); 
	/*
	var parttern = /http:\/\/(?:attach|jcimg)\.zhulong.com\/[^\"\'\<\>]+/mi;
	var match = parttern.exec(contentHmtl);
	var arrImg = new Array();
	if(match){
		arrImg.push(match);
	}*/
	//获取第一张img标签
	var arrImg = new Array();
	//console.debug(img);
	if(!img){
		arrImg='';
	}else{
		arrImg = img.split(',');
	}
    var divid = "show_relayBox";
    if (!document.getElementById(divid)) {
        var createDiv = document.createElement("div");
        createDiv.style.display = "none";
        createDiv.id = divid;
        document.body.appendChild(createDiv);
    }
    var box = document.getElementById(divid);
    var h = '';
	h += '	<div class="zhul_zb_content">';
	h += '		<span class="zhul_qyzx_zishu">还可以输入&nbsp;<span class="zhul_qyzx_shuzi" id="word" >10</span>&nbsp;字</span>';
    h += '		<textarea class="zhul_zb_text" id="texts" onkeyup='+'gbcounts("texts","word",140)'+'>'+content+'</textarea>';
	h += '		<div class="zhul_zb_biaoqing">';
	h += '			<a title="表情" href="javascript:void(0);" onclick="faceFun();"><img src="http://passport.zhulong.com/img/pubimg/faceIcon.gif">&nbsp;表情</a>';
	h += '			<div class="zhul_zb_facebox">';
	h += '				<p class="zhul_zb_jiao"></p>';
	h += '				<p class="zhul_zb_close"><a href="javascript:void(0);" class="zhul_zb_closeicon" onclick="closeFace();"></a></p>';
	h += '				<div class="zhul_zb_tabs">';
	h += '					<a href="javascript:void(0);" id="blueDragon" onclick="showLan();" class="zhul_zb_blue">阿龙</a><a href="javascript:void(0);" id="redDragon" onclick="showHong();">小鱼儿</a>';
	h += '				</div>';
	h += '				<div class="qqFaceBox">';
	h += '					<div id="emotions1"><a title="男-惊讶" data-code="f01" href="javascript:void(0);"></a><a title="男-流泪" data-code="f02" href="javascript:void(0);"></a><a title="男-害羞" data-code="f03" href="javascript:void(0);"></a><a title="男-闭嘴" data-code="f04" href="javascript:void(0);"></a><a title="男-睡" data-code="f05" href="javascript:void(0);"></a><a title="男-发怒" data-code="f06" href="javascript:void(0);"></a><a title="男-得意" data-code="f07" href="javascript:void(0);"></a><a title="男-抓狂" data-code="f08" href="javascript:void(0);"></a><a title="男-吐" data-code="f09" href="javascript:void(0);"></a><a title="男-偷笑" data-code="f10" href="javascript:void(0);"></a><a title="男-疑问" data-code="f11" href="javascript:void(0);"></a><a title="男-嘘" data-code="f12" href="javascript:void(0);"></a><a title="男-晕" data-code="f13" href="javascript:void(0);"></a><a title="男-衰" data-code="f14" href="javascript:void(0);"></a><a title="男-再见" data-code="f15" href="javascript:void(0);"></a><a title="男-猪头" data-code="f16" href="javascript:void(0);"></a><a title="男-爱心" data-code="f17" href="javascript:void(0);"></a><a title="男-心碎" data-code="f18" href="javascript:void(0);"></a><a title="男-拥抱" data-code="f19" href="javascript:void(0);"></a><a title="男-强" data-code="f20" href="javascript:void(0);"></a><a title="男-左哼哼" data-code="f21" href="javascript:void(0);"></a><a title="男-右哼哼" data-code="f22" href="javascript:void(0);"></a><a title="男-哈欠" data-code="f23" href="javascript:void(0);"></a><a title="男-鄙视" data-code="f24" href="javascript:void(0);"></a><a title="男-委屈" data-code="f25" href="javascript:void(0);"></a><a title="男-阴险" data-code="f26" href="javascript:void(0);"></a><a title="男-亲亲" data-code="f27" href="javascript:void(0);"></a><a title="男-可怜" data-code="f28" href="javascript:void(0);"></a><a title="男-勾引" data-code="f29" href="javascript:void(0);"></a><a title="男-NO" data-code="f30" href="javascript:void(0);"></a><a title="男-困" data-code="f31" href="javascript:void(0);"></a><a title="男-流汗" data-code="f32" href="javascript:void(0);"></a><a title="男-咒骂" data-code="f33" href="javascript:void(0);"></a><a title="男-弱" data-code="f34" href="javascript:void(0);"></a><a title="男-OK" data-code="f35" href="javascript:void(0);"></a><a title="男-抠鼻" data-code="f36" href="javascript:void(0);"></a><a title="男-鼓掌" data-code="f37" href="javascript:void(0);"></a></div>';
	h += '					<div id="emotions2" style="display:none"><a title="女-惊讶" data-code="f101" href="javascript:void(0);"></a><a title="女-流泪" data-code="f102" href="javascript:void(0);"></a><a title="女-害羞" data-code="f103" href="javascript:void(0);"></a><a title="女-闭嘴" data-code="f104" href="javascript:void(0);"></a><a title="女-睡" data-code="f105" href="javascript:void(0);"></a><a title="女-发怒" data-code="f106" href="javascript:void(0);"></a><a title="女-得意" data-code="f107" href="javascript:void(0);"></a><a title="女-抓狂" data-code="f108" href="javascript:void(0);"></a><a title="女-吐" data-code="f109" href="javascript:void(0);"></a><a title="女-偷笑" data-code="f110" href="javascript:void(0);"></a><a title="女-疑问" data-code="f111" href="javascript:void(0);"></a><a title="女-嘘" data-code="f112" href="javascript:void(0);"></a><a title="女-晕" data-code="f113" href="javascript:void(0);"></a><a title="女-衰" data-code="f114" href="javascript:void(0);"></a><a title="女-再见" data-code="f115" href="javascript:void(0);"></a><a title="女-猪头" data-code="f116" href="javascript:void(0);"></a><a title="女-爱心" data-code="f117" href="javascript:void(0);"></a><a title="女-心碎" data-code="f118" href="javascript:void(0);"></a><a title="女-拥抱" data-code="f119" href="javascript:void(0);"></a><a title="女-强" data-code="f120" href="javascript:void(0);"></a><a title="女-左哼哼" data-code="f121" href="javascript:void(0);"></a><a title="女-右哼哼" data-code="f122" href="javascript:void(0);"></a><a title="女-哈欠" data-code="f123" href="javascript:void(0);"></a><a title="女-鄙视" data-code="f124" href="javascript:void(0);"></a><a title="女-委屈" data-code="f125" href="javascript:void(0);"></a><a title="女-阴险" data-code="f126" href="javascript:void(0);"></a><a title="女-亲亲" data-code="f127" href="javascript:void(0);"></a><a title="女-可怜" data-code="f128" href="javascript:void(0);"></a><a title="女-勾引" data-code="f129" href="javascript:void(0);"></a><a title="女-NO" data-code="f130" href="javascript:void(0);"></a><a title="女-困" data-code="f131" href="javascript:void(0);"></a><a title="女-流汗" data-code="f132" href="javascript:void(0);"></a><a title="女-咒骂" data-code="f133" href="javascript:void(0);"></a><a title="女-弱" data-code="f134" href="javascript:void(0);"></a><a title="女-OK" data-code="f135" href="javascript:void(0);"></a><a title="女-抠鼻" data-code="f136" href="javascript:void(0);"></a><a title="女-鼓掌" data-code="f137" href="javascript:void(0);"></a></div>';
	h += '				</div>';
	h += '			</div>';
	h += '		</div>';
    h += '     <input type="hidden" id="arrImg" value="'+arrImg[0]+'" />';
	if(arrImg.length>0){
        h += '      <ul class="zhul_zb_imglist">';
        for(var i = 0;i < arrImg.length;i++){
            if(i == 0){
                h += '          <li class="zhul_zb_imgHv" onclick="selectImg(this.id)" id="img_'+i+'" name="checked">';
                h += '              <a href="javascript:void(0);"><img src="'+arrImg[i]+'" /></a><span class="zhul_zb_xuanzhong"></span>';
                h += '          </li>'   
            }else if(i < 4){
                h += '          <li class="" onclick="selectImg(this.id)" id="img_'+i+'" name="unchecked">';
                h += '              <a href="javascript:void(0);"><img src="'+arrImg[i]+'" /></a>';
                h += '          </li>'
            }else{
                h += '          <li class="" onclick="selectImg(this.id)" id="img_'+i+'" name="unchecked" style="display:none">';
                h += '              <a href="javascript:void(0);"><img src="'+arrImg[i]+'" /></a>';
                h += '          </li>'
            }
        }
		h += '        </ul>';
        if(arrImg.length > 1){
            h += '       <div class="zhul_zb_tishi">';
            h += '            <p class="zhul_zb_lmsg">最多可选择&nbsp;<span>9</span>&nbsp;张图片拼接转播，目前已选了&nbsp;<span>1</span>&nbsp;张</p>';
            if(arrImg.length > 4){
                h += '            <p class="zhul_zb_page"><a class="zhul_gc_grayLeft" href="javascript:;" onclick="changeImg(-1);"></a><a class="zhul_gc_blueRight" href="javascript:;" onclick="changeImg(1);"></a><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --><!-- --></p>';
            }
            h += '        </div>';   
        }
	}
	h += '	</div>';
    h += ' 	<div class="zhul_ly_fbbot">';
	h += '		<div id="comment_error_message" style="color:red;float:left;padding:15px 0 0 20px;"></div>';
    h += '		<div class="zhul_ly_tjright">';
	h += '			<input type="button" value="" class="zhul_zbbtn" onclick="thicksendWeibo()"><!--<p class="zhul_zb_zhuanyewb"><input name="" type="checkbox" value="" /><span class="zhul_cp_cytags">这是一条专业技术微博</span></p>-->';
    h += '		</div>';
    h += '	</div>';
    box.innerHTML = h;
    var boxHeigh = 265;
    if(arrImg.length>0){
    	boxHeigh = 402;
    }
    tb_show("转播",'#TB_inline?height='+boxHeigh+'&width=555&inlineId=' + divid,"thickbox");
  	gbcounts('texts','word',140) ;
}

function gbcounts(message,used,max) 
{	
	var len=getStrlen($("#"+message).val());
	if (len > max) 
	{
		var str = substr($("#"+message).val(),max);
		$("#"+message).val(str);
		return false;
	}
	else 
	{ 	
		$("#comment_error_message").html('');
		$("#"+used).text((max - len)); 
	} 
	if(len == 0){
		return false;
	}
} 
//发布微博
function thicksendWeibo(){
	var url=document.URL;
	var content=$("#texts").val();
	var img=$("#arrImg").val();
	if(!content||!url){
		$("#comment_error_message").html("别藏着掖着啦，精彩内容小伙伴们都想知道哦~").show();
		return ;
	}
	var strname={};
	strname['url']=url;
	strname['content']=content;
	strname['img']=img?img:'';
	$("#comment_error_message").html("正在转播中，请稍后。。。").show();
    $('input.zhul_zbbtn').attr('class','zhul_zb_graybtn').removeAttr('onclick');
    $.ajax({
		type:"post",
		url:"/ajax/sendWeibo",
		cache:false,
		data:strname,
		datatype:"json",
		success:callbackthickWeibo
	});		
}
//回调地址
function callbackthickWeibo(msg){
		var info=eval('('+msg+')');
		if (info.errNo == 0) {
		    $("#comment_error_message").html("").hide();
			$(".zhul_dt_phzhuanbo").removeClass("zhul_dt_phzhuanbo").addClass("zhul_al_zhuanbo");
			var num=$("#sharenum .havecount").html();
			if(num*1>=0){
				$("#sharenum .havecount").html(num*1+1);
				if($(".zhul_xx_timeBox .zhul_tgSeo_link span").length>0){
					$(".zhul_xx_timeBox .zhul_tgSeo_link span").html($(".zhul_xx_timeBox .zhul_tgSeo_link span").html()*1 +info.hot); //相册热度值
				}else if($("#hot_num").length>0){
					$("#hot_num").html($("#hot_num").html()*1 + info.hot); //博文热度值
				}else if($(".zhul_bw_hotL a").length>0){
					$(".zhul_bw_hotL a").html($(".zhul_bw_hotL a").html() * 1 +info.hot);  //加热数
				}
			}
			tb_remove();
			if (typeof info['status']!='undefined' && info['status'] == 0) {
				reviewSuccess('转播成功,审核后可见',3000);
			}else{
            	reviewSuccess('转播成功',1000);
			}
		}else{
            tb_remove();
            reviewError('转播失败',1000);
			//$("#comment_error_message").html('转发微博失败');
		}
}
function selectImg(imgId){
    $("#comment_error_message").html("").hide();
    if($('.zhul_zb_lmsg').length > 0){
        var num = $('.zhul_zb_lmsg span:last').html();
    }
    if($("#"+imgId).attr('name') == 'checked'){
        $("#"+imgId).attr('name','unchecked');
        $("#"+imgId).attr('class','');
        $("#"+imgId+' span').html();
        $("#"+imgId+' .zhul_zb_xuanzhong').remove();
        if(typeof num != 'undefined'){
            $('.zhul_zb_lmsg span:last').html(--num);
        }
    }else{
        if(num == 9){
            $("#comment_error_message").html("已选择了9张图片").show();
            return false;
        }
        $("#"+imgId).attr('name','checked');
        $("#"+imgId).attr('class','zhul_zb_imgHv');
        $("#"+imgId).append('<span class="zhul_zb_xuanzhong"></span>');
        if(typeof num != 'undefined'){
            $('.zhul_zb_lmsg span:last').html(++num);
        }
    }
    var img = new Array();
    $('.zhul_zb_imglist li[name=checked]').each(function(){
        img.push($(this).find('img').attr('src'));
    });
    if(!img){
        $('#arrImg').val('');    
    }else{
        $('#arrImg').val(img.join(','));   
    }
}
function faceFun(){
    $(".zhul_zb_facebox").show();
    $(".qqFaceBox div a").unbind("click");
    $(".qqFaceBox div a").click( function () {
        var title = $(this).attr("title");
        var txt = $(".zhul_zb_text").eq(0).val() + "/" + title;
        $(".zhul_zb_text").eq(0).val(txt);
        gbcounts('texts','word',140);
        closeFace();
    });
}
function closeFace(){
	$(".zhul_zb_facebox").hide();
}
function showLan(){
	$("#blueDragon").addClass("zhul_zb_blue");
	$("#redDragon").removeClass("zhul_zb_blue");
	$("#emotions1").show();
	$("#emotions2").hide();
}
function showHong(){
	$("#blueDragon").removeClass("zhul_zb_blue");
	$("#redDragon").addClass("zhul_zb_blue");
	$("#emotions1").hide();
	$("#emotions2").show();
}
function changeImg(s){
    var id = 0;
    var count = $('.zhul_zb_imglist li').length;
    if(count < 5){
        return false;
    }
    $('.zhul_zb_imglist li').each(function(i){
        if($(this).is(":visible")){
            id = i;
            return false;
        }
    });
    if(s > 0){
        if(id == count-4){
            return false;  
        }
        if(id == 0){
            $('p.zhul_zb_page a:first').attr('class','zhul_gc_blueLeft')
        }
        if(id == count-5){
            $('p.zhul_zb_page a:last').attr('class','zhul_gc_grayRight');
        }
        var nextid = id+4;
        $('#img_'+id).hide();
        $('#img_'+nextid).show();
    }else if(s < 0){
        if(id == 0){
            return false;
        }
        if(id == count-4){
            $('p.zhul_zb_page a:last').attr('class','zhul_gc_blueRight');
        }
        if(id == 1){
            $('p.zhul_zb_page a:first').attr('class','zhul_gc_grayLeft')
        }
        var nextid = id+3;
        $('#img_'+nextid).hide();
        var preid = id-1;
        $('#img_'+preid).show();
    }else{
        return false;
    }
}

function NewReviewError(content,t){
    var show_box=document.getElementById("show_box");
    if(show_box!= null)
    {
        document.getElementById("show_box").style.display="block";
    }
    else
    {
        var createDiv=document.createElement("div");
        createDiv.id="show_box";
        document.body.appendChild(createDiv);
    }
    var box=document.getElementById("show_box");
    var h = '';
    h+='<div class="tan_shoucang" style="display:table;">';
    // h+='<span class="xiao"></span>';
    h+='<p class="tishi">'+content+'</p>';
    h+='</div>';
    box.innerHTML = h; 
    var t_time = 3000;
    if(typeof t != 'undefined'){
        t_time = parseInt(t);
    } 
    // setTimeout('document.getElementById("show_box").style.display="none";$("#show_box").remove();',t_time);
    setTimeout('document.getElementById("show_box").style.display="none"',t_time);
}